package com.mikgonz.farkle;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

public class Main extends Activity {
	private AdView adView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		adView = new AdView(this, AdSize.BANNER, "a14d8aa2f22c2db");
		
		RelativeLayout layout = (RelativeLayout) findViewById(R.id.main_relative);
		
		RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-1, -2);
		params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
		layout.addView(adView, params);
		
		AdRequest r = new AdRequest();
		r.setTesting(true);
		r.addKeyword("android");
		adView.loadAd(r);
	}

	public void onStart(View v) {
		startActivity(new Intent(Main.this, GameScreen.class));
	}

	public void onExit(View v) {
		finish();
	}

	@Override
	public void onDestroy() {
		adView.stopLoading();
		super.onDestroy();
	}

}